<?php
/*
 *   This file is part of verbum.
 *
 *   poat is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   poat is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with poat.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * 	 Copyright (c) 2008 Sergio Gabriel Teves <gabriel.sgt at gmail.com>
 */
$t = new team;
$t->id = getTeamId($CURRENT_USER);
$loader->get($t);

$endline = "";
if (SCRIPT_DEV_MODE=="true") $endline = "\n";

echo "<script language=\"javascript\">";
if ($CURRENT_USER->timezone!="") {
	echo "var userLocale = ".$CURRENT_USER->timezone.";$endline";
} else {
	echo "var userLocal = 0;$endline";
}
echo "var userDateFormat = 'Y-m-d H:i';$endline";

echo "var userGroup = '".$CURRENT_USER->groupid."';$endline";
echo "var currentUser = '".$CURRENT_USER->userid."';$endline";
echo "var currentLang = '".$t->lang."';$endline";
echo "var cuTeamN = '".$t->name."';$endline";
echo "var MAX_FILE_SIZE = '".stringToBytes(MAX_FILESIZE)."';$endline";
echo "var KEEP_ALIVE = ".((SESSION_TIMEOUT*1000)-KEEP_ALIVE_OFFSET).";$endline";
echo "var DEFTRANS = new Array();$endline";
echo "var VBUILD = '".VERSION.".".BUILD.".".RELEASED."';$endline";
echo "var COOKIE_EXPIRE = '".COOKIE_EXPIRE."';$endline";
echo "var DEFAULT_LIST_SIZE = ".DEFAULT_LIST_SIZE.";$endline";

foreach ($FILE_STATUS_LIST as $obj) {
	echo "var ".$obj['id'] ." = '".$obj['value']."';$endline";
	$k = String::toString($obj['value']);
}
foreach ($FILE_UPLOAD_LIST as $obj) {
	echo "var ".$obj['id'] ." = '".$obj['value']."';$endline";
}
foreach ($STATUS_LIST as $obj) {
	echo "var ".$obj ." = '".$obj."';$endline";
}
foreach ($DEF_TRANS as $k => $v) {
	echo "DEFTRANS['".$k."'] = \"".addcslashes(util::decode(s($v)),"\n\r")."\";$endline";
}
?>	
</script>